const express = require("express");
const { addProjectServices, getProjectServices, deleteProjectServices, updateProjectServices } = require("../services/projectServices");
const router = express.Router();

// 获取所有项目
router.get("/", async (req, res, next) => {
    res.send(await getProjectServices());
})

// 修改项目
router.put("/:id", async (req, res, next) => {
    res.send(await updateProjectServices(req.params.id, req.body))
})

// 添加项目
router.post("/", async (req, res, next) => {
    console.log("req.body", req.body);
    res.send(await addProjectServices(req.body))
})

//删除项目 
router.delete("/:id", async (req, res, next) => {
    res.send(await deleteProjectServices(req.params.id));
})

module.exports = router;